home *** CD-ROM | disk | FTP | other *** search
- Path: alterdial.uu.net!dweaver
- From: dweaver@nondum.cleaf.com (David Weaver)
- Newsgroups: comp.lang.c++
- Subject: Re: Strange (to me) notation - little help?
- Date: 4 Jan 1996 03:57:55 GMT
- Message-ID: <4cfj83$1a5@alterdial.UU.NET>
- References: <30EB32AC.2836@sierra.net>
- Reply-To: dweaver@clover.cleaf.com
- NNTP-Posting-Host: dial3txk.cleaf.com
-
- In article <30EB32AC.2836@sierra.net>, "Tyler G. Colwell" <snowbull@sierra.net> writes:
-
- |> SimpleCat::SimpleCat(int age, int weight):
- |> itsAge(age), itsWeight(weight) {}
- |> ***********************************************
- |>
- |> Wow, those last two lines are dumbfounding. What is the colon at the end
- |> of that one line for, and what's up
- |> with using members itsAge and itsWeight as functions in the last line,
- |> and howcome none of them are inside the
- |> braces?
-
- The colon at the end of the line introduces a member initialization list
- The member initialization list follows the colon. The members itsAge
- and itsWeight are not exactly being used as functions; they are being
- initialized. The braces are empty because, for this particular class
- constructor, there is no assignment phase following the initialization phase.
-
- It seems odd that a primer would introduce that syntax without any prior
- explination. Look in your index for "member initialization list" to see
- if there's an explination in the book.
-
-